<!DOCTYPE html>
<html>
<head>
    <title>注册</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="">
    <link rel="stylesheet" href="./lib/weui.min.css">
    <link rel="stylesheet" href="./css/jquery-weui.css">
    <link rel="stylesheet" href="./css/demos.css">
</head>

<body ontouchstart>

<header class='demos-header'>
    <h1 class="demos-title">注册</h1>
</header>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" placeholder="姓名" name="username" id="username">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" id="tel" type="tel" pattern="[0-9]*" placeholder="请输入手机号" name="tel">
        </div>
    </div>
</div>

<div class="weui-btn-area">
    <a class="weui-btn weui-btn_primary" href="javascript:" id="submit">确定</a>
</div>

<script src="./lib/jquery-2.1.4.js"></script>
<script src="./lib/fastclick.js"></script>
<script>
    $(function () {
        FastClick.attach(document.body);
    });
</script>
<script src="./js/jquery-weui.js"></script>


<script>
    $("#submit").click(function () {
        var tel = $('#tel').val();
        var username = $('#username').val();
        if (!username || username == '') $.toptip('请输入姓名');
        else if (!tel || !/1[3|4|5|7|8]\d{9}/.test(tel)) $.toptip('请输入手机号');
        else $.toptip('提交成功', 'success');
    });
</script>
</body>
</html>
